package com.itheima.String;

public class Demo02StringConstructor {
    public static void main(String[] args) {
        //创建一个空字符串
        String s1 = new String();
        System.out.println(s1);

        //根据字符数组创建一个字符串
        char[] arr = {'a', 's', 'd'};
        String s2 = new String(arr);
        System.out.println(s2);

        //根据一个字节数组创建一个字符串
        byte[] arr2 = {97, 98, 99};
        String s3 = new String(arr2);
        System.out.println(s3);

        //根据传递的内容创建一个字符串
        String s4 = new String("abc");
        System.out.println(s4);

        //直接赋值
        String s5 = "bcd";
        System.out.println(s5);
    }
}
